Shader "Unlit/building2" {
Properties {
 _MainTex ("Base (RGB)", 2D) = "white" { }
 _MainTex2 ("Base (RGB)", 2D) = "white" { }
 _AoTex ("AO (RGB)", 2D) = "white" { }
 _GradTex ("Color Grading (RGB)", 2D) = "white" { }
 _3dTex ("3D texture (RGB)", 2D) = "white" { }
 _Fade ("Fade", Float) = 0
 _AO ("AO", Float) = 0
 _m0 ("m 0", Vector) = (1,0,0,0)
 _m1 ("m 1", Vector) = (0,1,0,0)
 _m2 ("m 2", Vector) = (0,0,1,0)
 _m3 ("m 3", Vector) = (0,0,0,1)
}
SubShader { 
 LOD 100
 Tags { "RenderType"="Opaque" }
 Pass {
  Tags { "RenderType"="Opaque" }
  GpuProgramID 20705
Program "vp" {
SubProgram "gles " {
"#version 100

#ifdef VERTEX
attribute vec4 _glesVertex;
attribute vec3 _glesNormal;
attribute vec4 _glesMultiTexCoord0;
uniform highp vec4 _Time;
uniform highp mat4 glstate_matrix_mvp;
uniform highp mat4 _Object2World;
uniform sampler2D _3dTex;
uniform highp float _Fade;
uniform highp vec4 _m0;
uniform highp vec4 _m1;
uniform highp vec4 _m2;
uniform highp vec4 _m3;
varying highp vec2 xlv_TEXCOORD0;
varying lowp vec4 xlv_COLOR;
void main ()
{
  highp vec3 tmpvar_1;
  tmpvar_1 = _glesNormal;
  highp vec2 tmpvar_2;
  tmpvar_2 = _glesMultiTexCoord0.xy;
  highp vec4 tmpvar_3;
  tmpvar_3 = _glesVertex;
  mediump vec4 tex3di_4;
  highp vec4 tex3dn_5;
  highp vec3 uvw_6;
  highp vec4 myVec_7;
  highp float factor_8;
  lowp vec4 tmpvar_9;
  factor_8 = 1.0;
  highp mat4 tmpvar_10;
  tmpvar_10[0].x = _m0.x;
  tmpvar_10[0].y = _m1.x;
  tmpvar_10[0].z = _m2.x;
  tmpvar_10[0].w = _m3.x;
  tmpvar_10[1].x = _m0.y;
  tmpvar_10[1].y = _m1.y;
  tmpvar_10[1].z = _m2.y;
  tmpvar_10[1].w = _m3.y;
  tmpvar_10[2].x = _m0.z;
  tmpvar_10[2].y = _m1.z;
  tmpvar_10[2].z = _m2.z;
  tmpvar_10[2].w = _m3.z;
  tmpvar_10[3].x = _m0.w;
  tmpvar_10[3].y = _m1.w;
  tmpvar_10[3].z = _m2.w;
  tmpvar_10[3].w = _m3.w;
  myVec_7.w = 1.0;
  myVec_7.xyz = (_glesVertex.xyz - (_glesNormal * 0.1));
  myVec_7 = (_Object2World * myVec_7);
  uvw_6 = ((myVec_7 * tmpvar_10).xyz + 0.5);
  uvw_6.y = max (uvw_6.y, ((uvw_6.y * 0.5) + 1.0));
  uvw_6.y = (uvw_6.y - 0.5);
  uvw_6 = (uvw_6 / 16.0);
  highp vec3 ws_11;
  ws_11 = (uvw_6 - vec3(0.03125, 0.03125, 0.03125));
  highp vec3 uvw_12;
  uvw_12 = (floor((ws_11 * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_13;
  tmpvar_13.x = ((uvw_12.x / 16.0) + uvw_12.z);
  tmpvar_13.y = uvw_12.y;
  highp vec4 tmpvar_14;
  lowp vec4 tmpvar_15;
  tmpvar_15 = texture2DLod (_3dTex, tmpvar_13, 0.0);
  tmpvar_14 = tmpvar_15;
  highp vec3 uvw_16;
  uvw_16 = (floor((
    (ws_11 + vec3(0.0625, 0.0, 0.0))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_17;
  tmpvar_17.x = ((uvw_16.x / 16.0) + uvw_16.z);
  tmpvar_17.y = uvw_16.y;
  highp vec4 tmpvar_18;
  lowp vec4 tmpvar_19;
  tmpvar_19 = texture2DLod (_3dTex, tmpvar_17, 0.0);
  tmpvar_18 = tmpvar_19;
  highp vec3 uvw_20;
  uvw_20 = (floor((
    (ws_11 + vec3(0.0, 0.0625, 0.0))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_21;
  tmpvar_21.x = ((uvw_20.x / 16.0) + uvw_20.z);
  tmpvar_21.y = uvw_20.y;
  highp vec4 tmpvar_22;
  lowp vec4 tmpvar_23;
  tmpvar_23 = texture2DLod (_3dTex, tmpvar_21, 0.0);
  tmpvar_22 = tmpvar_23;
  highp vec3 uvw_24;
  uvw_24 = (floor((
    (ws_11 + vec3(0.0625, 0.0625, 0.0))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_25;
  tmpvar_25.x = ((uvw_24.x / 16.0) + uvw_24.z);
  tmpvar_25.y = uvw_24.y;
  highp vec4 tmpvar_26;
  lowp vec4 tmpvar_27;
  tmpvar_27 = texture2DLod (_3dTex, tmpvar_25, 0.0);
  tmpvar_26 = tmpvar_27;
  highp vec3 uvw_28;
  uvw_28 = (floor((
    (ws_11 + vec3(0.0, 0.0, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_29;
  tmpvar_29.x = ((uvw_28.x / 16.0) + uvw_28.z);
  tmpvar_29.y = uvw_28.y;
  highp vec4 tmpvar_30;
  lowp vec4 tmpvar_31;
  tmpvar_31 = texture2DLod (_3dTex, tmpvar_29, 0.0);
  tmpvar_30 = tmpvar_31;
  highp vec3 uvw_32;
  uvw_32 = (floor((
    (ws_11 + vec3(0.0625, 0.0, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_33;
  tmpvar_33.x = ((uvw_32.x / 16.0) + uvw_32.z);
  tmpvar_33.y = uvw_32.y;
  highp vec4 tmpvar_34;
  lowp vec4 tmpvar_35;
  tmpvar_35 = texture2DLod (_3dTex, tmpvar_33, 0.0);
  tmpvar_34 = tmpvar_35;
  highp vec3 uvw_36;
  uvw_36 = (floor((
    (ws_11 + vec3(0.0, 0.0625, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_37;
  tmpvar_37.x = ((uvw_36.x / 16.0) + uvw_36.z);
  tmpvar_37.y = uvw_36.y;
  highp vec4 tmpvar_38;
  lowp vec4 tmpvar_39;
  tmpvar_39 = texture2DLod (_3dTex, tmpvar_37, 0.0);
  tmpvar_38 = tmpvar_39;
  highp vec3 uvw_40;
  uvw_40 = (floor((
    (ws_11 + vec3(0.0625, 0.0625, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_41;
  tmpvar_41.x = ((uvw_40.x / 16.0) + uvw_40.z);
  tmpvar_41.y = uvw_40.y;
  highp vec4 tmpvar_42;
  lowp vec4 tmpvar_43;
  tmpvar_43 = texture2DLod (_3dTex, tmpvar_41, 0.0);
  tmpvar_42 = tmpvar_43;
  highp vec3 tmpvar_44;
  tmpvar_44 = ((ws_11 * vec3(16.0, 16.0, 16.0)) + vec3(16.0, 16.0, 16.0));
  highp vec3 tmpvar_45;
  tmpvar_45 = fract(abs(tmpvar_44));
  highp float tmpvar_46;
  if ((tmpvar_44.x >= 0.0)) {
    tmpvar_46 = tmpvar_45.x;
  } else {
    tmpvar_46 = -(tmpvar_45.x);
  };
  highp float tmpvar_47;
  if ((tmpvar_44.y >= 0.0)) {
    tmpvar_47 = tmpvar_45.y;
  } else {
    tmpvar_47 = -(tmpvar_45.y);
  };
  highp float tmpvar_48;
  if ((tmpvar_44.z >= 0.0)) {
    tmpvar_48 = tmpvar_45.z;
  } else {
    tmpvar_48 = -(tmpvar_45.z);
  };
  highp vec3 tmpvar_49;
  tmpvar_49.x = tmpvar_46;
  tmpvar_49.y = tmpvar_47;
  tmpvar_49.z = tmpvar_48;
  highp vec3 tmpvar_50;
  tmpvar_50 = clamp (tmpvar_49, 0.0, 1.0);
  highp vec4 tmpvar_51;
  tmpvar_51 = mix (mix (mix (tmpvar_14, tmpvar_18, tmpvar_50.xxxx), mix (tmpvar_22, tmpvar_26, tmpvar_50.xxxx), tmpvar_50.yyyy), mix (mix (tmpvar_30, tmpvar_34, tmpvar_50.xxxx), mix (tmpvar_38, tmpvar_42, tmpvar_50.xxxx), tmpvar_50.yyyy), tmpvar_50.zzzz);
  highp vec3 uvw_52;
  uvw_52 = (floor((
    (uvw_6 + vec3(0.03125, 0.03125, 0.03125))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_53;
  tmpvar_53.x = ((uvw_52.x / 16.0) + uvw_52.z);
  tmpvar_53.y = uvw_52.y;
  highp vec4 tmpvar_54;
  lowp vec4 tmpvar_55;
  tmpvar_55 = texture2DLod (_3dTex, tmpvar_53, 0.0);
  tmpvar_54 = tmpvar_55;
  if ((_Fade > 0.0)) {
    factor_8 = clamp (((tmpvar_51.x * 2.0) - 1.0), 0.0, 1.0);
  };
  factor_8 = (factor_8 * float((myVec_7.y >= 0.5)));
  tmpvar_3.xyz = (_glesVertex.xyz + ((_glesNormal * _Fade) * (0.5 * factor_8)));
  tmpvar_3.y = (tmpvar_3.y + ((
    (tmpvar_54.z * sin(((_Time.z * 0.5) + (tmpvar_54.y * 6.0))))
   * 0.1) * clamp (
    ((myVec_7.y - 0.7) / 0.3)
  , 0.0, 1.0)));
  highp vec4 tmpvar_56;
  tmpvar_56.w = 0.0;
  tmpvar_56.xyz = tmpvar_1;
  highp vec3 tmpvar_57;
  tmpvar_57 = (_Object2World * tmpvar_56).xyz;
  tex3dn_5 = vec4(0.0, 0.0, 0.0, 0.0);
  highp vec3 ws_58;
  ws_58 = (uvw_6 + ((
    (tmpvar_57 * 0.9)
   + vec3(-0.5, -0.5, -0.5)) / vec3(16.0, 16.0, 16.0)));
  ws_58 = (ws_58 - vec3(0.03125, 0.03125, 0.03125));
  highp vec3 uvw_59;
  uvw_59 = (floor((ws_58 * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_60;
  tmpvar_60.x = ((uvw_59.x / 16.0) + uvw_59.z);
  tmpvar_60.y = uvw_59.y;
  highp vec4 tmpvar_61;
  lowp vec4 tmpvar_62;
  tmpvar_62 = texture2DLod (_3dTex, tmpvar_60, 0.0);
  tmpvar_61 = tmpvar_62;
  highp vec3 uvw_63;
  uvw_63 = (floor((
    (ws_58 + vec3(0.0625, 0.0, 0.0))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_64;
  tmpvar_64.x = ((uvw_63.x / 16.0) + uvw_63.z);
  tmpvar_64.y = uvw_63.y;
  highp vec4 tmpvar_65;
  lowp vec4 tmpvar_66;
  tmpvar_66 = texture2DLod (_3dTex, tmpvar_64, 0.0);
  tmpvar_65 = tmpvar_66;
  highp vec3 uvw_67;
  uvw_67 = (floor((
    (ws_58 + vec3(0.0, 0.0625, 0.0))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_68;
  tmpvar_68.x = ((uvw_67.x / 16.0) + uvw_67.z);
  tmpvar_68.y = uvw_67.y;
  highp vec4 tmpvar_69;
  lowp vec4 tmpvar_70;
  tmpvar_70 = texture2DLod (_3dTex, tmpvar_68, 0.0);
  tmpvar_69 = tmpvar_70;
  highp vec3 uvw_71;
  uvw_71 = (floor((
    (ws_58 + vec3(0.0625, 0.0625, 0.0))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_72;
  tmpvar_72.x = ((uvw_71.x / 16.0) + uvw_71.z);
  tmpvar_72.y = uvw_71.y;
  highp vec4 tmpvar_73;
  lowp vec4 tmpvar_74;
  tmpvar_74 = texture2DLod (_3dTex, tmpvar_72, 0.0);
  tmpvar_73 = tmpvar_74;
  highp vec3 uvw_75;
  uvw_75 = (floor((
    (ws_58 + vec3(0.0, 0.0, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_76;
  tmpvar_76.x = ((uvw_75.x / 16.0) + uvw_75.z);
  tmpvar_76.y = uvw_75.y;
  highp vec4 tmpvar_77;
  lowp vec4 tmpvar_78;
  tmpvar_78 = texture2DLod (_3dTex, tmpvar_76, 0.0);
  tmpvar_77 = tmpvar_78;
  highp vec3 uvw_79;
  uvw_79 = (floor((
    (ws_58 + vec3(0.0625, 0.0, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_80;
  tmpvar_80.x = ((uvw_79.x / 16.0) + uvw_79.z);
  tmpvar_80.y = uvw_79.y;
  highp vec4 tmpvar_81;
  lowp vec4 tmpvar_82;
  tmpvar_82 = texture2DLod (_3dTex, tmpvar_80, 0.0);
  tmpvar_81 = tmpvar_82;
  highp vec3 uvw_83;
  uvw_83 = (floor((
    (ws_58 + vec3(0.0, 0.0625, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_84;
  tmpvar_84.x = ((uvw_83.x / 16.0) + uvw_83.z);
  tmpvar_84.y = uvw_83.y;
  highp vec4 tmpvar_85;
  lowp vec4 tmpvar_86;
  tmpvar_86 = texture2DLod (_3dTex, tmpvar_84, 0.0);
  tmpvar_85 = tmpvar_86;
  highp vec3 uvw_87;
  uvw_87 = (floor((
    (ws_58 + vec3(0.0625, 0.0625, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_88;
  tmpvar_88.x = ((uvw_87.x / 16.0) + uvw_87.z);
  tmpvar_88.y = uvw_87.y;
  highp vec4 tmpvar_89;
  lowp vec4 tmpvar_90;
  tmpvar_90 = texture2DLod (_3dTex, tmpvar_88, 0.0);
  tmpvar_89 = tmpvar_90;
  highp vec3 tmpvar_91;
  tmpvar_91 = ((ws_58 * vec3(16.0, 16.0, 16.0)) + vec3(16.0, 16.0, 16.0));
  highp vec3 tmpvar_92;
  tmpvar_92 = fract(abs(tmpvar_91));
  highp float tmpvar_93;
  if ((tmpvar_91.x >= 0.0)) {
    tmpvar_93 = tmpvar_92.x;
  } else {
    tmpvar_93 = -(tmpvar_92.x);
  };
  highp float tmpvar_94;
  if ((tmpvar_91.y >= 0.0)) {
    tmpvar_94 = tmpvar_92.y;
  } else {
    tmpvar_94 = -(tmpvar_92.y);
  };
  highp float tmpvar_95;
  if ((tmpvar_91.z >= 0.0)) {
    tmpvar_95 = tmpvar_92.z;
  } else {
    tmpvar_95 = -(tmpvar_92.z);
  };
  highp vec3 tmpvar_96;
  tmpvar_96.x = tmpvar_93;
  tmpvar_96.y = tmpvar_94;
  tmpvar_96.z = tmpvar_95;
  highp vec3 tmpvar_97;
  tmpvar_97 = clamp (tmpvar_96, 0.0, 1.0);
  tex3dn_5 = mix (mix (mix (tmpvar_61, tmpvar_65, tmpvar_97.xxxx), mix (tmpvar_69, tmpvar_73, tmpvar_97.xxxx), tmpvar_97.yyyy), mix (mix (tmpvar_77, tmpvar_81, tmpvar_97.xxxx), mix (tmpvar_85, tmpvar_89, tmpvar_97.xxxx), tmpvar_97.yyyy), tmpvar_97.zzzz);
  highp vec3 ws_98;
  ws_98 = (uvw_6 + ((
    (tmpvar_57 * 0.9)
   + vec3(0.5, -0.5, -0.5)) / vec3(16.0, 16.0, 16.0)));
  ws_98 = (ws_98 - vec3(0.03125, 0.03125, 0.03125));
  highp vec3 uvw_99;
  uvw_99 = (floor((ws_98 * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_100;
  tmpvar_100.x = ((uvw_99.x / 16.0) + uvw_99.z);
  tmpvar_100.y = uvw_99.y;
  highp vec4 tmpvar_101;
  lowp vec4 tmpvar_102;
  tmpvar_102 = texture2DLod (_3dTex, tmpvar_100, 0.0);
  tmpvar_101 = tmpvar_102;
  highp vec3 uvw_103;
  uvw_103 = (floor((
    (ws_98 + vec3(0.0625, 0.0, 0.0))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_104;
  tmpvar_104.x = ((uvw_103.x / 16.0) + uvw_103.z);
  tmpvar_104.y = uvw_103.y;
  highp vec4 tmpvar_105;
  lowp vec4 tmpvar_106;
  tmpvar_106 = texture2DLod (_3dTex, tmpvar_104, 0.0);
  tmpvar_105 = tmpvar_106;
  highp vec3 uvw_107;
  uvw_107 = (floor((
    (ws_98 + vec3(0.0, 0.0625, 0.0))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_108;
  tmpvar_108.x = ((uvw_107.x / 16.0) + uvw_107.z);
  tmpvar_108.y = uvw_107.y;
  highp vec4 tmpvar_109;
  lowp vec4 tmpvar_110;
  tmpvar_110 = texture2DLod (_3dTex, tmpvar_108, 0.0);
  tmpvar_109 = tmpvar_110;
  highp vec3 uvw_111;
  uvw_111 = (floor((
    (ws_98 + vec3(0.0625, 0.0625, 0.0))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_112;
  tmpvar_112.x = ((uvw_111.x / 16.0) + uvw_111.z);
  tmpvar_112.y = uvw_111.y;
  highp vec4 tmpvar_113;
  lowp vec4 tmpvar_114;
  tmpvar_114 = texture2DLod (_3dTex, tmpvar_112, 0.0);
  tmpvar_113 = tmpvar_114;
  highp vec3 uvw_115;
  uvw_115 = (floor((
    (ws_98 + vec3(0.0, 0.0, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_116;
  tmpvar_116.x = ((uvw_115.x / 16.0) + uvw_115.z);
  tmpvar_116.y = uvw_115.y;
  highp vec4 tmpvar_117;
  lowp vec4 tmpvar_118;
  tmpvar_118 = texture2DLod (_3dTex, tmpvar_116, 0.0);
  tmpvar_117 = tmpvar_118;
  highp vec3 uvw_119;
  uvw_119 = (floor((
    (ws_98 + vec3(0.0625, 0.0, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_120;
  tmpvar_120.x = ((uvw_119.x / 16.0) + uvw_119.z);
  tmpvar_120.y = uvw_119.y;
  highp vec4 tmpvar_121;
  lowp vec4 tmpvar_122;
  tmpvar_122 = texture2DLod (_3dTex, tmpvar_120, 0.0);
  tmpvar_121 = tmpvar_122;
  highp vec3 uvw_123;
  uvw_123 = (floor((
    (ws_98 + vec3(0.0, 0.0625, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_124;
  tmpvar_124.x = ((uvw_123.x / 16.0) + uvw_123.z);
  tmpvar_124.y = uvw_123.y;
  highp vec4 tmpvar_125;
  lowp vec4 tmpvar_126;
  tmpvar_126 = texture2DLod (_3dTex, tmpvar_124, 0.0);
  tmpvar_125 = tmpvar_126;
  highp vec3 uvw_127;
  uvw_127 = (floor((
    (ws_98 + vec3(0.0625, 0.0625, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_128;
  tmpvar_128.x = ((uvw_127.x / 16.0) + uvw_127.z);
  tmpvar_128.y = uvw_127.y;
  highp vec4 tmpvar_129;
  lowp vec4 tmpvar_130;
  tmpvar_130 = texture2DLod (_3dTex, tmpvar_128, 0.0);
  tmpvar_129 = tmpvar_130;
  highp vec3 tmpvar_131;
  tmpvar_131 = ((ws_98 * vec3(16.0, 16.0, 16.0)) + vec3(16.0, 16.0, 16.0));
  highp vec3 tmpvar_132;
  tmpvar_132 = fract(abs(tmpvar_131));
  highp float tmpvar_133;
  if ((tmpvar_131.x >= 0.0)) {
    tmpvar_133 = tmpvar_132.x;
  } else {
    tmpvar_133 = -(tmpvar_132.x);
  };
  highp float tmpvar_134;
  if ((tmpvar_131.y >= 0.0)) {
    tmpvar_134 = tmpvar_132.y;
  } else {
    tmpvar_134 = -(tmpvar_132.y);
  };
  highp float tmpvar_135;
  if ((tmpvar_131.z >= 0.0)) {
    tmpvar_135 = tmpvar_132.z;
  } else {
    tmpvar_135 = -(tmpvar_132.z);
  };
  highp vec3 tmpvar_136;
  tmpvar_136.x = tmpvar_133;
  tmpvar_136.y = tmpvar_134;
  tmpvar_136.z = tmpvar_135;
  highp vec3 tmpvar_137;
  tmpvar_137 = clamp (tmpvar_136, 0.0, 1.0);
  tex3dn_5 = (tex3dn_5 + mix (mix (
    mix (tmpvar_101, tmpvar_105, tmpvar_137.xxxx)
  , 
    mix (tmpvar_109, tmpvar_113, tmpvar_137.xxxx)
  , tmpvar_137.yyyy), mix (
    mix (tmpvar_117, tmpvar_121, tmpvar_137.xxxx)
  , 
    mix (tmpvar_125, tmpvar_129, tmpvar_137.xxxx)
  , tmpvar_137.yyyy), tmpvar_137.zzzz));
  highp vec3 ws_138;
  ws_138 = (uvw_6 + ((
    (tmpvar_57 * 0.9)
   + vec3(-0.5, 0.5, -0.5)) / vec3(16.0, 16.0, 16.0)));
  ws_138 = (ws_138 - vec3(0.03125, 0.03125, 0.03125));
  highp vec3 uvw_139;
  uvw_139 = (floor((ws_138 * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_140;
  tmpvar_140.x = ((uvw_139.x / 16.0) + uvw_139.z);
  tmpvar_140.y = uvw_139.y;
  highp vec4 tmpvar_141;
  lowp vec4 tmpvar_142;
  tmpvar_142 = texture2DLod (_3dTex, tmpvar_140, 0.0);
  tmpvar_141 = tmpvar_142;
  highp vec3 uvw_143;
  uvw_143 = (floor((
    (ws_138 + vec3(0.0625, 0.0, 0.0))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_144;
  tmpvar_144.x = ((uvw_143.x / 16.0) + uvw_143.z);
  tmpvar_144.y = uvw_143.y;
  highp vec4 tmpvar_145;
  lowp vec4 tmpvar_146;
  tmpvar_146 = texture2DLod (_3dTex, tmpvar_144, 0.0);
  tmpvar_145 = tmpvar_146;
  highp vec3 uvw_147;
  uvw_147 = (floor((
    (ws_138 + vec3(0.0, 0.0625, 0.0))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_148;
  tmpvar_148.x = ((uvw_147.x / 16.0) + uvw_147.z);
  tmpvar_148.y = uvw_147.y;
  highp vec4 tmpvar_149;
  lowp vec4 tmpvar_150;
  tmpvar_150 = texture2DLod (_3dTex, tmpvar_148, 0.0);
  tmpvar_149 = tmpvar_150;
  highp vec3 uvw_151;
  uvw_151 = (floor((
    (ws_138 + vec3(0.0625, 0.0625, 0.0))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_152;
  tmpvar_152.x = ((uvw_151.x / 16.0) + uvw_151.z);
  tmpvar_152.y = uvw_151.y;
  highp vec4 tmpvar_153;
  lowp vec4 tmpvar_154;
  tmpvar_154 = texture2DLod (_3dTex, tmpvar_152, 0.0);
  tmpvar_153 = tmpvar_154;
  highp vec3 uvw_155;
  uvw_155 = (floor((
    (ws_138 + vec3(0.0, 0.0, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_156;
  tmpvar_156.x = ((uvw_155.x / 16.0) + uvw_155.z);
  tmpvar_156.y = uvw_155.y;
  highp vec4 tmpvar_157;
  lowp vec4 tmpvar_158;
  tmpvar_158 = texture2DLod (_3dTex, tmpvar_156, 0.0);
  tmpvar_157 = tmpvar_158;
  highp vec3 uvw_159;
  uvw_159 = (floor((
    (ws_138 + vec3(0.0625, 0.0, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_160;
  tmpvar_160.x = ((uvw_159.x / 16.0) + uvw_159.z);
  tmpvar_160.y = uvw_159.y;
  highp vec4 tmpvar_161;
  lowp vec4 tmpvar_162;
  tmpvar_162 = texture2DLod (_3dTex, tmpvar_160, 0.0);
  tmpvar_161 = tmpvar_162;
  highp vec3 uvw_163;
  uvw_163 = (floor((
    (ws_138 + vec3(0.0, 0.0625, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_164;
  tmpvar_164.x = ((uvw_163.x / 16.0) + uvw_163.z);
  tmpvar_164.y = uvw_163.y;
  highp vec4 tmpvar_165;
  lowp vec4 tmpvar_166;
  tmpvar_166 = texture2DLod (_3dTex, tmpvar_164, 0.0);
  tmpvar_165 = tmpvar_166;
  highp vec3 uvw_167;
  uvw_167 = (floor((
    (ws_138 + vec3(0.0625, 0.0625, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_168;
  tmpvar_168.x = ((uvw_167.x / 16.0) + uvw_167.z);
  tmpvar_168.y = uvw_167.y;
  highp vec4 tmpvar_169;
  lowp vec4 tmpvar_170;
  tmpvar_170 = texture2DLod (_3dTex, tmpvar_168, 0.0);
  tmpvar_169 = tmpvar_170;
  highp vec3 tmpvar_171;
  tmpvar_171 = ((ws_138 * vec3(16.0, 16.0, 16.0)) + vec3(16.0, 16.0, 16.0));
  highp vec3 tmpvar_172;
  tmpvar_172 = fract(abs(tmpvar_171));
  highp float tmpvar_173;
  if ((tmpvar_171.x >= 0.0)) {
    tmpvar_173 = tmpvar_172.x;
  } else {
    tmpvar_173 = -(tmpvar_172.x);
  };
  highp float tmpvar_174;
  if ((tmpvar_171.y >= 0.0)) {
    tmpvar_174 = tmpvar_172.y;
  } else {
    tmpvar_174 = -(tmpvar_172.y);
  };
  highp float tmpvar_175;
  if ((tmpvar_171.z >= 0.0)) {
    tmpvar_175 = tmpvar_172.z;
  } else {
    tmpvar_175 = -(tmpvar_172.z);
  };
  highp vec3 tmpvar_176;
  tmpvar_176.x = tmpvar_173;
  tmpvar_176.y = tmpvar_174;
  tmpvar_176.z = tmpvar_175;
  highp vec3 tmpvar_177;
  tmpvar_177 = clamp (tmpvar_176, 0.0, 1.0);
  tex3dn_5 = (tex3dn_5 + mix (mix (
    mix (tmpvar_141, tmpvar_145, tmpvar_177.xxxx)
  , 
    mix (tmpvar_149, tmpvar_153, tmpvar_177.xxxx)
  , tmpvar_177.yyyy), mix (
    mix (tmpvar_157, tmpvar_161, tmpvar_177.xxxx)
  , 
    mix (tmpvar_165, tmpvar_169, tmpvar_177.xxxx)
  , tmpvar_177.yyyy), tmpvar_177.zzzz));
  highp vec3 ws_178;
  ws_178 = (uvw_6 + ((
    (tmpvar_57 * 0.9)
   + vec3(0.5, 0.5, -0.5)) / vec3(16.0, 16.0, 16.0)));
  ws_178 = (ws_178 - vec3(0.03125, 0.03125, 0.03125));
  highp vec3 uvw_179;
  uvw_179 = (floor((ws_178 * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_180;
  tmpvar_180.x = ((uvw_179.x / 16.0) + uvw_179.z);
  tmpvar_180.y = uvw_179.y;
  highp vec4 tmpvar_181;
  lowp vec4 tmpvar_182;
  tmpvar_182 = texture2DLod (_3dTex, tmpvar_180, 0.0);
  tmpvar_181 = tmpvar_182;
  highp vec3 uvw_183;
  uvw_183 = (floor((
    (ws_178 + vec3(0.0625, 0.0, 0.0))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_184;
  tmpvar_184.x = ((uvw_183.x / 16.0) + uvw_183.z);
  tmpvar_184.y = uvw_183.y;
  highp vec4 tmpvar_185;
  lowp vec4 tmpvar_186;
  tmpvar_186 = texture2DLod (_3dTex, tmpvar_184, 0.0);
  tmpvar_185 = tmpvar_186;
  highp vec3 uvw_187;
  uvw_187 = (floor((
    (ws_178 + vec3(0.0, 0.0625, 0.0))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_188;
  tmpvar_188.x = ((uvw_187.x / 16.0) + uvw_187.z);
  tmpvar_188.y = uvw_187.y;
  highp vec4 tmpvar_189;
  lowp vec4 tmpvar_190;
  tmpvar_190 = texture2DLod (_3dTex, tmpvar_188, 0.0);
  tmpvar_189 = tmpvar_190;
  highp vec3 uvw_191;
  uvw_191 = (floor((
    (ws_178 + vec3(0.0625, 0.0625, 0.0))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_192;
  tmpvar_192.x = ((uvw_191.x / 16.0) + uvw_191.z);
  tmpvar_192.y = uvw_191.y;
  highp vec4 tmpvar_193;
  lowp vec4 tmpvar_194;
  tmpvar_194 = texture2DLod (_3dTex, tmpvar_192, 0.0);
  tmpvar_193 = tmpvar_194;
  highp vec3 uvw_195;
  uvw_195 = (floor((
    (ws_178 + vec3(0.0, 0.0, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_196;
  tmpvar_196.x = ((uvw_195.x / 16.0) + uvw_195.z);
  tmpvar_196.y = uvw_195.y;
  highp vec4 tmpvar_197;
  lowp vec4 tmpvar_198;
  tmpvar_198 = texture2DLod (_3dTex, tmpvar_196, 0.0);
  tmpvar_197 = tmpvar_198;
  highp vec3 uvw_199;
  uvw_199 = (floor((
    (ws_178 + vec3(0.0625, 0.0, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_200;
  tmpvar_200.x = ((uvw_199.x / 16.0) + uvw_199.z);
  tmpvar_200.y = uvw_199.y;
  highp vec4 tmpvar_201;
  lowp vec4 tmpvar_202;
  tmpvar_202 = texture2DLod (_3dTex, tmpvar_200, 0.0);
  tmpvar_201 = tmpvar_202;
  highp vec3 uvw_203;
  uvw_203 = (floor((
    (ws_178 + vec3(0.0, 0.0625, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_204;
  tmpvar_204.x = ((uvw_203.x / 16.0) + uvw_203.z);
  tmpvar_204.y = uvw_203.y;
  highp vec4 tmpvar_205;
  lowp vec4 tmpvar_206;
  tmpvar_206 = texture2DLod (_3dTex, tmpvar_204, 0.0);
  tmpvar_205 = tmpvar_206;
  highp vec3 uvw_207;
  uvw_207 = (floor((
    (ws_178 + vec3(0.0625, 0.0625, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_208;
  tmpvar_208.x = ((uvw_207.x / 16.0) + uvw_207.z);
  tmpvar_208.y = uvw_207.y;
  highp vec4 tmpvar_209;
  lowp vec4 tmpvar_210;
  tmpvar_210 = texture2DLod (_3dTex, tmpvar_208, 0.0);
  tmpvar_209 = tmpvar_210;
  highp vec3 tmpvar_211;
  tmpvar_211 = ((ws_178 * vec3(16.0, 16.0, 16.0)) + vec3(16.0, 16.0, 16.0));
  highp vec3 tmpvar_212;
  tmpvar_212 = fract(abs(tmpvar_211));
  highp float tmpvar_213;
  if ((tmpvar_211.x >= 0.0)) {
    tmpvar_213 = tmpvar_212.x;
  } else {
    tmpvar_213 = -(tmpvar_212.x);
  };
  highp float tmpvar_214;
  if ((tmpvar_211.y >= 0.0)) {
    tmpvar_214 = tmpvar_212.y;
  } else {
    tmpvar_214 = -(tmpvar_212.y);
  };
  highp float tmpvar_215;
  if ((tmpvar_211.z >= 0.0)) {
    tmpvar_215 = tmpvar_212.z;
  } else {
    tmpvar_215 = -(tmpvar_212.z);
  };
  highp vec3 tmpvar_216;
  tmpvar_216.x = tmpvar_213;
  tmpvar_216.y = tmpvar_214;
  tmpvar_216.z = tmpvar_215;
  highp vec3 tmpvar_217;
  tmpvar_217 = clamp (tmpvar_216, 0.0, 1.0);
  tex3dn_5 = (tex3dn_5 + mix (mix (
    mix (tmpvar_181, tmpvar_185, tmpvar_217.xxxx)
  , 
    mix (tmpvar_189, tmpvar_193, tmpvar_217.xxxx)
  , tmpvar_217.yyyy), mix (
    mix (tmpvar_197, tmpvar_201, tmpvar_217.xxxx)
  , 
    mix (tmpvar_205, tmpvar_209, tmpvar_217.xxxx)
  , tmpvar_217.yyyy), tmpvar_217.zzzz));
  highp vec3 ws_218;
  ws_218 = (uvw_6 + ((
    (tmpvar_57 * 0.9)
   + vec3(-0.5, -0.5, 0.5)) / vec3(16.0, 16.0, 16.0)));
  ws_218 = (ws_218 - vec3(0.03125, 0.03125, 0.03125));
  highp vec3 uvw_219;
  uvw_219 = (floor((ws_218 * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_220;
  tmpvar_220.x = ((uvw_219.x / 16.0) + uvw_219.z);
  tmpvar_220.y = uvw_219.y;
  highp vec4 tmpvar_221;
  lowp vec4 tmpvar_222;
  tmpvar_222 = texture2DLod (_3dTex, tmpvar_220, 0.0);
  tmpvar_221 = tmpvar_222;
  highp vec3 uvw_223;
  uvw_223 = (floor((
    (ws_218 + vec3(0.0625, 0.0, 0.0))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_224;
  tmpvar_224.x = ((uvw_223.x / 16.0) + uvw_223.z);
  tmpvar_224.y = uvw_223.y;
  highp vec4 tmpvar_225;
  lowp vec4 tmpvar_226;
  tmpvar_226 = texture2DLod (_3dTex, tmpvar_224, 0.0);
  tmpvar_225 = tmpvar_226;
  highp vec3 uvw_227;
  uvw_227 = (floor((
    (ws_218 + vec3(0.0, 0.0625, 0.0))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_228;
  tmpvar_228.x = ((uvw_227.x / 16.0) + uvw_227.z);
  tmpvar_228.y = uvw_227.y;
  highp vec4 tmpvar_229;
  lowp vec4 tmpvar_230;
  tmpvar_230 = texture2DLod (_3dTex, tmpvar_228, 0.0);
  tmpvar_229 = tmpvar_230;
  highp vec3 uvw_231;
  uvw_231 = (floor((
    (ws_218 + vec3(0.0625, 0.0625, 0.0))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_232;
  tmpvar_232.x = ((uvw_231.x / 16.0) + uvw_231.z);
  tmpvar_232.y = uvw_231.y;
  highp vec4 tmpvar_233;
  lowp vec4 tmpvar_234;
  tmpvar_234 = texture2DLod (_3dTex, tmpvar_232, 0.0);
  tmpvar_233 = tmpvar_234;
  highp vec3 uvw_235;
  uvw_235 = (floor((
    (ws_218 + vec3(0.0, 0.0, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_236;
  tmpvar_236.x = ((uvw_235.x / 16.0) + uvw_235.z);
  tmpvar_236.y = uvw_235.y;
  highp vec4 tmpvar_237;
  lowp vec4 tmpvar_238;
  tmpvar_238 = texture2DLod (_3dTex, tmpvar_236, 0.0);
  tmpvar_237 = tmpvar_238;
  highp vec3 uvw_239;
  uvw_239 = (floor((
    (ws_218 + vec3(0.0625, 0.0, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_240;
  tmpvar_240.x = ((uvw_239.x / 16.0) + uvw_239.z);
  tmpvar_240.y = uvw_239.y;
  highp vec4 tmpvar_241;
  lowp vec4 tmpvar_242;
  tmpvar_242 = texture2DLod (_3dTex, tmpvar_240, 0.0);
  tmpvar_241 = tmpvar_242;
  highp vec3 uvw_243;
  uvw_243 = (floor((
    (ws_218 + vec3(0.0, 0.0625, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_244;
  tmpvar_244.x = ((uvw_243.x / 16.0) + uvw_243.z);
  tmpvar_244.y = uvw_243.y;
  highp vec4 tmpvar_245;
  lowp vec4 tmpvar_246;
  tmpvar_246 = texture2DLod (_3dTex, tmpvar_244, 0.0);
  tmpvar_245 = tmpvar_246;
  highp vec3 uvw_247;
  uvw_247 = (floor((
    (ws_218 + vec3(0.0625, 0.0625, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_248;
  tmpvar_248.x = ((uvw_247.x / 16.0) + uvw_247.z);
  tmpvar_248.y = uvw_247.y;
  highp vec4 tmpvar_249;
  lowp vec4 tmpvar_250;
  tmpvar_250 = texture2DLod (_3dTex, tmpvar_248, 0.0);
  tmpvar_249 = tmpvar_250;
  highp vec3 tmpvar_251;
  tmpvar_251 = ((ws_218 * vec3(16.0, 16.0, 16.0)) + vec3(16.0, 16.0, 16.0));
  highp vec3 tmpvar_252;
  tmpvar_252 = fract(abs(tmpvar_251));
  highp float tmpvar_253;
  if ((tmpvar_251.x >= 0.0)) {
    tmpvar_253 = tmpvar_252.x;
  } else {
    tmpvar_253 = -(tmpvar_252.x);
  };
  highp float tmpvar_254;
  if ((tmpvar_251.y >= 0.0)) {
    tmpvar_254 = tmpvar_252.y;
  } else {
    tmpvar_254 = -(tmpvar_252.y);
  };
  highp float tmpvar_255;
  if ((tmpvar_251.z >= 0.0)) {
    tmpvar_255 = tmpvar_252.z;
  } else {
    tmpvar_255 = -(tmpvar_252.z);
  };
  highp vec3 tmpvar_256;
  tmpvar_256.x = tmpvar_253;
  tmpvar_256.y = tmpvar_254;
  tmpvar_256.z = tmpvar_255;
  highp vec3 tmpvar_257;
  tmpvar_257 = clamp (tmpvar_256, 0.0, 1.0);
  tex3dn_5 = (tex3dn_5 + mix (mix (
    mix (tmpvar_221, tmpvar_225, tmpvar_257.xxxx)
  , 
    mix (tmpvar_229, tmpvar_233, tmpvar_257.xxxx)
  , tmpvar_257.yyyy), mix (
    mix (tmpvar_237, tmpvar_241, tmpvar_257.xxxx)
  , 
    mix (tmpvar_245, tmpvar_249, tmpvar_257.xxxx)
  , tmpvar_257.yyyy), tmpvar_257.zzzz));
  highp vec3 ws_258;
  ws_258 = (uvw_6 + ((
    (tmpvar_57 * 0.9)
   + vec3(0.5, -0.5, 0.5)) / vec3(16.0, 16.0, 16.0)));
  ws_258 = (ws_258 - vec3(0.03125, 0.03125, 0.03125));
  highp vec3 uvw_259;
  uvw_259 = (floor((ws_258 * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_260;
  tmpvar_260.x = ((uvw_259.x / 16.0) + uvw_259.z);
  tmpvar_260.y = uvw_259.y;
  highp vec4 tmpvar_261;
  lowp vec4 tmpvar_262;
  tmpvar_262 = texture2DLod (_3dTex, tmpvar_260, 0.0);
  tmpvar_261 = tmpvar_262;
  highp vec3 uvw_263;
  uvw_263 = (floor((
    (ws_258 + vec3(0.0625, 0.0, 0.0))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_264;
  tmpvar_264.x = ((uvw_263.x / 16.0) + uvw_263.z);
  tmpvar_264.y = uvw_263.y;
  highp vec4 tmpvar_265;
  lowp vec4 tmpvar_266;
  tmpvar_266 = texture2DLod (_3dTex, tmpvar_264, 0.0);
  tmpvar_265 = tmpvar_266;
  highp vec3 uvw_267;
  uvw_267 = (floor((
    (ws_258 + vec3(0.0, 0.0625, 0.0))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_268;
  tmpvar_268.x = ((uvw_267.x / 16.0) + uvw_267.z);
  tmpvar_268.y = uvw_267.y;
  highp vec4 tmpvar_269;
  lowp vec4 tmpvar_270;
  tmpvar_270 = texture2DLod (_3dTex, tmpvar_268, 0.0);
  tmpvar_269 = tmpvar_270;
  highp vec3 uvw_271;
  uvw_271 = (floor((
    (ws_258 + vec3(0.0625, 0.0625, 0.0))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_272;
  tmpvar_272.x = ((uvw_271.x / 16.0) + uvw_271.z);
  tmpvar_272.y = uvw_271.y;
  highp vec4 tmpvar_273;
  lowp vec4 tmpvar_274;
  tmpvar_274 = texture2DLod (_3dTex, tmpvar_272, 0.0);
  tmpvar_273 = tmpvar_274;
  highp vec3 uvw_275;
  uvw_275 = (floor((
    (ws_258 + vec3(0.0, 0.0, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_276;
  tmpvar_276.x = ((uvw_275.x / 16.0) + uvw_275.z);
  tmpvar_276.y = uvw_275.y;
  highp vec4 tmpvar_277;
  lowp vec4 tmpvar_278;
  tmpvar_278 = texture2DLod (_3dTex, tmpvar_276, 0.0);
  tmpvar_277 = tmpvar_278;
  highp vec3 uvw_279;
  uvw_279 = (floor((
    (ws_258 + vec3(0.0625, 0.0, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_280;
  tmpvar_280.x = ((uvw_279.x / 16.0) + uvw_279.z);
  tmpvar_280.y = uvw_279.y;
  highp vec4 tmpvar_281;
  lowp vec4 tmpvar_282;
  tmpvar_282 = texture2DLod (_3dTex, tmpvar_280, 0.0);
  tmpvar_281 = tmpvar_282;
  highp vec3 uvw_283;
  uvw_283 = (floor((
    (ws_258 + vec3(0.0, 0.0625, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_284;
  tmpvar_284.x = ((uvw_283.x / 16.0) + uvw_283.z);
  tmpvar_284.y = uvw_283.y;
  highp vec4 tmpvar_285;
  lowp vec4 tmpvar_286;
  tmpvar_286 = texture2DLod (_3dTex, tmpvar_284, 0.0);
  tmpvar_285 = tmpvar_286;
  highp vec3 uvw_287;
  uvw_287 = (floor((
    (ws_258 + vec3(0.0625, 0.0625, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_288;
  tmpvar_288.x = ((uvw_287.x / 16.0) + uvw_287.z);
  tmpvar_288.y = uvw_287.y;
  highp vec4 tmpvar_289;
  lowp vec4 tmpvar_290;
  tmpvar_290 = texture2DLod (_3dTex, tmpvar_288, 0.0);
  tmpvar_289 = tmpvar_290;
  highp vec3 tmpvar_291;
  tmpvar_291 = ((ws_258 * vec3(16.0, 16.0, 16.0)) + vec3(16.0, 16.0, 16.0));
  highp vec3 tmpvar_292;
  tmpvar_292 = fract(abs(tmpvar_291));
  highp float tmpvar_293;
  if ((tmpvar_291.x >= 0.0)) {
    tmpvar_293 = tmpvar_292.x;
  } else {
    tmpvar_293 = -(tmpvar_292.x);
  };
  highp float tmpvar_294;
  if ((tmpvar_291.y >= 0.0)) {
    tmpvar_294 = tmpvar_292.y;
  } else {
    tmpvar_294 = -(tmpvar_292.y);
  };
  highp float tmpvar_295;
  if ((tmpvar_291.z >= 0.0)) {
    tmpvar_295 = tmpvar_292.z;
  } else {
    tmpvar_295 = -(tmpvar_292.z);
  };
  highp vec3 tmpvar_296;
  tmpvar_296.x = tmpvar_293;
  tmpvar_296.y = tmpvar_294;
  tmpvar_296.z = tmpvar_295;
  highp vec3 tmpvar_297;
  tmpvar_297 = clamp (tmpvar_296, 0.0, 1.0);
  tex3dn_5 = (tex3dn_5 + mix (mix (
    mix (tmpvar_261, tmpvar_265, tmpvar_297.xxxx)
  , 
    mix (tmpvar_269, tmpvar_273, tmpvar_297.xxxx)
  , tmpvar_297.yyyy), mix (
    mix (tmpvar_277, tmpvar_281, tmpvar_297.xxxx)
  , 
    mix (tmpvar_285, tmpvar_289, tmpvar_297.xxxx)
  , tmpvar_297.yyyy), tmpvar_297.zzzz));
  highp vec3 ws_298;
  ws_298 = (uvw_6 + ((
    (tmpvar_57 * 0.9)
   + vec3(-0.5, 0.5, 0.5)) / vec3(16.0, 16.0, 16.0)));
  ws_298 = (ws_298 - vec3(0.03125, 0.03125, 0.03125));
  highp vec3 uvw_299;
  uvw_299 = (floor((ws_298 * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_300;
  tmpvar_300.x = ((uvw_299.x / 16.0) + uvw_299.z);
  tmpvar_300.y = uvw_299.y;
  highp vec4 tmpvar_301;
  lowp vec4 tmpvar_302;
  tmpvar_302 = texture2DLod (_3dTex, tmpvar_300, 0.0);
  tmpvar_301 = tmpvar_302;
  highp vec3 uvw_303;
  uvw_303 = (floor((
    (ws_298 + vec3(0.0625, 0.0, 0.0))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_304;
  tmpvar_304.x = ((uvw_303.x / 16.0) + uvw_303.z);
  tmpvar_304.y = uvw_303.y;
  highp vec4 tmpvar_305;
  lowp vec4 tmpvar_306;
  tmpvar_306 = texture2DLod (_3dTex, tmpvar_304, 0.0);
  tmpvar_305 = tmpvar_306;
  highp vec3 uvw_307;
  uvw_307 = (floor((
    (ws_298 + vec3(0.0, 0.0625, 0.0))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_308;
  tmpvar_308.x = ((uvw_307.x / 16.0) + uvw_307.z);
  tmpvar_308.y = uvw_307.y;
  highp vec4 tmpvar_309;
  lowp vec4 tmpvar_310;
  tmpvar_310 = texture2DLod (_3dTex, tmpvar_308, 0.0);
  tmpvar_309 = tmpvar_310;
  highp vec3 uvw_311;
  uvw_311 = (floor((
    (ws_298 + vec3(0.0625, 0.0625, 0.0))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_312;
  tmpvar_312.x = ((uvw_311.x / 16.0) + uvw_311.z);
  tmpvar_312.y = uvw_311.y;
  highp vec4 tmpvar_313;
  lowp vec4 tmpvar_314;
  tmpvar_314 = texture2DLod (_3dTex, tmpvar_312, 0.0);
  tmpvar_313 = tmpvar_314;
  highp vec3 uvw_315;
  uvw_315 = (floor((
    (ws_298 + vec3(0.0, 0.0, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_316;
  tmpvar_316.x = ((uvw_315.x / 16.0) + uvw_315.z);
  tmpvar_316.y = uvw_315.y;
  highp vec4 tmpvar_317;
  lowp vec4 tmpvar_318;
  tmpvar_318 = texture2DLod (_3dTex, tmpvar_316, 0.0);
  tmpvar_317 = tmpvar_318;
  highp vec3 uvw_319;
  uvw_319 = (floor((
    (ws_298 + vec3(0.0625, 0.0, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_320;
  tmpvar_320.x = ((uvw_319.x / 16.0) + uvw_319.z);
  tmpvar_320.y = uvw_319.y;
  highp vec4 tmpvar_321;
  lowp vec4 tmpvar_322;
  tmpvar_322 = texture2DLod (_3dTex, tmpvar_320, 0.0);
  tmpvar_321 = tmpvar_322;
  highp vec3 uvw_323;
  uvw_323 = (floor((
    (ws_298 + vec3(0.0, 0.0625, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_324;
  tmpvar_324.x = ((uvw_323.x / 16.0) + uvw_323.z);
  tmpvar_324.y = uvw_323.y;
  highp vec4 tmpvar_325;
  lowp vec4 tmpvar_326;
  tmpvar_326 = texture2DLod (_3dTex, tmpvar_324, 0.0);
  tmpvar_325 = tmpvar_326;
  highp vec3 uvw_327;
  uvw_327 = (floor((
    (ws_298 + vec3(0.0625, 0.0625, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_328;
  tmpvar_328.x = ((uvw_327.x / 16.0) + uvw_327.z);
  tmpvar_328.y = uvw_327.y;
  highp vec4 tmpvar_329;
  lowp vec4 tmpvar_330;
  tmpvar_330 = texture2DLod (_3dTex, tmpvar_328, 0.0);
  tmpvar_329 = tmpvar_330;
  highp vec3 tmpvar_331;
  tmpvar_331 = ((ws_298 * vec3(16.0, 16.0, 16.0)) + vec3(16.0, 16.0, 16.0));
  highp vec3 tmpvar_332;
  tmpvar_332 = fract(abs(tmpvar_331));
  highp float tmpvar_333;
  if ((tmpvar_331.x >= 0.0)) {
    tmpvar_333 = tmpvar_332.x;
  } else {
    tmpvar_333 = -(tmpvar_332.x);
  };
  highp float tmpvar_334;
  if ((tmpvar_331.y >= 0.0)) {
    tmpvar_334 = tmpvar_332.y;
  } else {
    tmpvar_334 = -(tmpvar_332.y);
  };
  highp float tmpvar_335;
  if ((tmpvar_331.z >= 0.0)) {
    tmpvar_335 = tmpvar_332.z;
  } else {
    tmpvar_335 = -(tmpvar_332.z);
  };
  highp vec3 tmpvar_336;
  tmpvar_336.x = tmpvar_333;
  tmpvar_336.y = tmpvar_334;
  tmpvar_336.z = tmpvar_335;
  highp vec3 tmpvar_337;
  tmpvar_337 = clamp (tmpvar_336, 0.0, 1.0);
  tex3dn_5 = (tex3dn_5 + mix (mix (
    mix (tmpvar_301, tmpvar_305, tmpvar_337.xxxx)
  , 
    mix (tmpvar_309, tmpvar_313, tmpvar_337.xxxx)
  , tmpvar_337.yyyy), mix (
    mix (tmpvar_317, tmpvar_321, tmpvar_337.xxxx)
  , 
    mix (tmpvar_325, tmpvar_329, tmpvar_337.xxxx)
  , tmpvar_337.yyyy), tmpvar_337.zzzz));
  highp vec3 ws_338;
  ws_338 = (uvw_6 + ((
    (tmpvar_57 * 0.9)
   + vec3(0.5, 0.5, 0.5)) / vec3(16.0, 16.0, 16.0)));
  ws_338 = (ws_338 - vec3(0.03125, 0.03125, 0.03125));
  highp vec3 uvw_339;
  uvw_339 = (floor((ws_338 * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_340;
  tmpvar_340.x = ((uvw_339.x / 16.0) + uvw_339.z);
  tmpvar_340.y = uvw_339.y;
  highp vec4 tmpvar_341;
  lowp vec4 tmpvar_342;
  tmpvar_342 = texture2DLod (_3dTex, tmpvar_340, 0.0);
  tmpvar_341 = tmpvar_342;
  highp vec3 uvw_343;
  uvw_343 = (floor((
    (ws_338 + vec3(0.0625, 0.0, 0.0))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_344;
  tmpvar_344.x = ((uvw_343.x / 16.0) + uvw_343.z);
  tmpvar_344.y = uvw_343.y;
  highp vec4 tmpvar_345;
  lowp vec4 tmpvar_346;
  tmpvar_346 = texture2DLod (_3dTex, tmpvar_344, 0.0);
  tmpvar_345 = tmpvar_346;
  highp vec3 uvw_347;
  uvw_347 = (floor((
    (ws_338 + vec3(0.0, 0.0625, 0.0))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_348;
  tmpvar_348.x = ((uvw_347.x / 16.0) + uvw_347.z);
  tmpvar_348.y = uvw_347.y;
  highp vec4 tmpvar_349;
  lowp vec4 tmpvar_350;
  tmpvar_350 = texture2DLod (_3dTex, tmpvar_348, 0.0);
  tmpvar_349 = tmpvar_350;
  highp vec3 uvw_351;
  uvw_351 = (floor((
    (ws_338 + vec3(0.0625, 0.0625, 0.0))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_352;
  tmpvar_352.x = ((uvw_351.x / 16.0) + uvw_351.z);
  tmpvar_352.y = uvw_351.y;
  highp vec4 tmpvar_353;
  lowp vec4 tmpvar_354;
  tmpvar_354 = texture2DLod (_3dTex, tmpvar_352, 0.0);
  tmpvar_353 = tmpvar_354;
  highp vec3 uvw_355;
  uvw_355 = (floor((
    (ws_338 + vec3(0.0, 0.0, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_356;
  tmpvar_356.x = ((uvw_355.x / 16.0) + uvw_355.z);
  tmpvar_356.y = uvw_355.y;
  highp vec4 tmpvar_357;
  lowp vec4 tmpvar_358;
  tmpvar_358 = texture2DLod (_3dTex, tmpvar_356, 0.0);
  tmpvar_357 = tmpvar_358;
  highp vec3 uvw_359;
  uvw_359 = (floor((
    (ws_338 + vec3(0.0625, 0.0, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_360;
  tmpvar_360.x = ((uvw_359.x / 16.0) + uvw_359.z);
  tmpvar_360.y = uvw_359.y;
  highp vec4 tmpvar_361;
  lowp vec4 tmpvar_362;
  tmpvar_362 = texture2DLod (_3dTex, tmpvar_360, 0.0);
  tmpvar_361 = tmpvar_362;
  highp vec3 uvw_363;
  uvw_363 = (floor((
    (ws_338 + vec3(0.0, 0.0625, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_364;
  tmpvar_364.x = ((uvw_363.x / 16.0) + uvw_363.z);
  tmpvar_364.y = uvw_363.y;
  highp vec4 tmpvar_365;
  lowp vec4 tmpvar_366;
  tmpvar_366 = texture2DLod (_3dTex, tmpvar_364, 0.0);
  tmpvar_365 = tmpvar_366;
  highp vec3 uvw_367;
  uvw_367 = (floor((
    (ws_338 + vec3(0.0625, 0.0625, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_368;
  tmpvar_368.x = ((uvw_367.x / 16.0) + uvw_367.z);
  tmpvar_368.y = uvw_367.y;
  highp vec4 tmpvar_369;
  lowp vec4 tmpvar_370;
  tmpvar_370 = texture2DLod (_3dTex, tmpvar_368, 0.0);
  tmpvar_369 = tmpvar_370;
  highp vec3 tmpvar_371;
  tmpvar_371 = ((ws_338 * vec3(16.0, 16.0, 16.0)) + vec3(16.0, 16.0, 16.0));
  highp vec3 tmpvar_372;
  tmpvar_372 = fract(abs(tmpvar_371));
  highp float tmpvar_373;
  if ((tmpvar_371.x >= 0.0)) {
    tmpvar_373 = tmpvar_372.x;
  } else {
    tmpvar_373 = -(tmpvar_372.x);
  };
  highp float tmpvar_374;
  if ((tmpvar_371.y >= 0.0)) {
    tmpvar_374 = tmpvar_372.y;
  } else {
    tmpvar_374 = -(tmpvar_372.y);
  };
  highp float tmpvar_375;
  if ((tmpvar_371.z >= 0.0)) {
    tmpvar_375 = tmpvar_372.z;
  } else {
    tmpvar_375 = -(tmpvar_372.z);
  };
  highp vec3 tmpvar_376;
  tmpvar_376.x = tmpvar_373;
  tmpvar_376.y = tmpvar_374;
  tmpvar_376.z = tmpvar_375;
  highp vec3 tmpvar_377;
  tmpvar_377 = clamp (tmpvar_376, 0.0, 1.0);
  tex3dn_5 = (tex3dn_5 + mix (mix (
    mix (tmpvar_341, tmpvar_345, tmpvar_377.xxxx)
  , 
    mix (tmpvar_349, tmpvar_353, tmpvar_377.xxxx)
  , tmpvar_377.yyyy), mix (
    mix (tmpvar_357, tmpvar_361, tmpvar_377.xxxx)
  , 
    mix (tmpvar_365, tmpvar_369, tmpvar_377.xxxx)
  , tmpvar_377.yyyy), tmpvar_377.zzzz));
  tex3dn_5 = (tex3dn_5 / 8.0);
  highp vec3 ws_378;
  ws_378 = (vec3(0.03126, 0.03126, 0.03126) + uvw_6);
  ws_378 = (ws_378 - vec3(0.03125, 0.03125, 0.03125));
  highp vec3 uvw_379;
  uvw_379 = (floor((ws_378 * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_380;
  tmpvar_380.x = ((uvw_379.x / 16.0) + uvw_379.z);
  tmpvar_380.y = uvw_379.y;
  highp vec4 tmpvar_381;
  lowp vec4 tmpvar_382;
  tmpvar_382 = texture2DLod (_3dTex, tmpvar_380, 0.0);
  tmpvar_381 = tmpvar_382;
  highp vec3 uvw_383;
  uvw_383 = (floor((
    (ws_378 + vec3(0.0625, 0.0, 0.0))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_384;
  tmpvar_384.x = ((uvw_383.x / 16.0) + uvw_383.z);
  tmpvar_384.y = uvw_383.y;
  highp vec4 tmpvar_385;
  lowp vec4 tmpvar_386;
  tmpvar_386 = texture2DLod (_3dTex, tmpvar_384, 0.0);
  tmpvar_385 = tmpvar_386;
  highp vec3 uvw_387;
  uvw_387 = (floor((
    (ws_378 + vec3(0.0, 0.0625, 0.0))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_388;
  tmpvar_388.x = ((uvw_387.x / 16.0) + uvw_387.z);
  tmpvar_388.y = uvw_387.y;
  highp vec4 tmpvar_389;
  lowp vec4 tmpvar_390;
  tmpvar_390 = texture2DLod (_3dTex, tmpvar_388, 0.0);
  tmpvar_389 = tmpvar_390;
  highp vec3 uvw_391;
  uvw_391 = (floor((
    (ws_378 + vec3(0.0625, 0.0625, 0.0))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_392;
  tmpvar_392.x = ((uvw_391.x / 16.0) + uvw_391.z);
  tmpvar_392.y = uvw_391.y;
  highp vec4 tmpvar_393;
  lowp vec4 tmpvar_394;
  tmpvar_394 = texture2DLod (_3dTex, tmpvar_392, 0.0);
  tmpvar_393 = tmpvar_394;
  highp vec3 uvw_395;
  uvw_395 = (floor((
    (ws_378 + vec3(0.0, 0.0, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_396;
  tmpvar_396.x = ((uvw_395.x / 16.0) + uvw_395.z);
  tmpvar_396.y = uvw_395.y;
  highp vec4 tmpvar_397;
  lowp vec4 tmpvar_398;
  tmpvar_398 = texture2DLod (_3dTex, tmpvar_396, 0.0);
  tmpvar_397 = tmpvar_398;
  highp vec3 uvw_399;
  uvw_399 = (floor((
    (ws_378 + vec3(0.0625, 0.0, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_400;
  tmpvar_400.x = ((uvw_399.x / 16.0) + uvw_399.z);
  tmpvar_400.y = uvw_399.y;
  highp vec4 tmpvar_401;
  lowp vec4 tmpvar_402;
  tmpvar_402 = texture2DLod (_3dTex, tmpvar_400, 0.0);
  tmpvar_401 = tmpvar_402;
  highp vec3 uvw_403;
  uvw_403 = (floor((
    (ws_378 + vec3(0.0, 0.0625, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_404;
  tmpvar_404.x = ((uvw_403.x / 16.0) + uvw_403.z);
  tmpvar_404.y = uvw_403.y;
  highp vec4 tmpvar_405;
  lowp vec4 tmpvar_406;
  tmpvar_406 = texture2DLod (_3dTex, tmpvar_404, 0.0);
  tmpvar_405 = tmpvar_406;
  highp vec3 uvw_407;
  uvw_407 = (floor((
    (ws_378 + vec3(0.0625, 0.0625, 0.0625))
   * vec3(16.0, 16.0, 16.0))) / vec3(16.0, 16.0, 16.0));
  highp vec2 tmpvar_408;
  tmpvar_408.x = ((uvw_407.x / 16.0) + uvw_407.z);
  tmpvar_408.y = uvw_407.y;
  highp vec4 tmpvar_409;
  lowp vec4 tmpvar_410;
  tmpvar_410 = texture2DLod (_3dTex, tmpvar_408, 0.0);
  tmpvar_409 = tmpvar_410;
  highp vec3 tmpvar_411;
  tmpvar_411 = ((ws_378 * vec3(16.0, 16.0, 16.0)) + vec3(16.0, 16.0, 16.0));
  highp vec3 tmpvar_412;
  tmpvar_412 = fract(abs(tmpvar_411));
  highp float tmpvar_413;
  if ((tmpvar_411.x >= 0.0)) {
    tmpvar_413 = tmpvar_412.x;
  } else {
    tmpvar_413 = -(tmpvar_412.x);
  };
  highp float tmpvar_414;
  if ((tmpvar_411.y >= 0.0)) {
    tmpvar_414 = tmpvar_412.y;
  } else {
    tmpvar_414 = -(tmpvar_412.y);
  };
  highp float tmpvar_415;
  if ((tmpvar_411.z >= 0.0)) {
    tmpvar_415 = tmpvar_412.z;
  } else {
    tmpvar_415 = -(tmpvar_412.z);
  };
  highp vec3 tmpvar_416;
  tmpvar_416.x = tmpvar_413;
  tmpvar_416.y = tmpvar_414;
  tmpvar_416.z = tmpvar_415;
  highp vec3 tmpvar_417;
  tmpvar_417 = clamp (tmpvar_416, 0.0, 1.0);
  highp vec4 tmpvar_418;
  tmpvar_418 = mix (mix (mix (tmpvar_381, tmpvar_385, tmpvar_417.xxxx), mix (tmpvar_389, tmpvar_393, tmpvar_417.xxxx), tmpvar_417.yyyy), mix (mix (tmpvar_397, tmpvar_401, tmpvar_417.xxxx), mix (tmpvar_405, tmpvar_409, tmpvar_417.xxxx), tmpvar_417.yyyy), tmpvar_417.zzzz);
  tex3di_4 = tmpvar_418;
  uvw_6.y = (uvw_6.y + 0.03125);
  highp vec4 tmpvar_419;
  tmpvar_419 = tex3dn_5.xxxx;
  tmpvar_9.zw = tmpvar_419.zw;
  tmpvar_9.x = tex3dn_5.x;
  tmpvar_9.y = tex3di_4.y;
  xlv_TEXCOORD0 = tmpvar_2;
  xlv_COLOR = tmpvar_9;
  gl_Position = (glstate_matrix_mvp * tmpvar_3);
}


#endif
#ifdef FRAGMENT
#extension GL_EXT_shader_texture_lod : enable
lowp vec4 impl_low_texture2DLodEXT(lowp sampler2D sampler, highp vec2 coord, mediump float lod)
{
#if defined(GL_EXT_shader_texture_lod)
	return texture2DLodEXT(sampler, coord, lod);
#else
	return texture2D(sampler, coord, lod);
#endif
}

uniform sampler2D _MainTex;
uniform sampler2D _MainTex2;
uniform sampler2D _GradTex;
uniform highp float _Fade;
uniform highp float _AO;
varying highp vec2 xlv_TEXCOORD0;
varying lowp vec4 xlv_COLOR;
void main ()
{
  highp float ao_1;
  lowp vec4 col_2;
  mediump vec4 mainTex2_3;
  mediump vec4 mainTex_4;
  lowp vec4 tmpvar_5;
  tmpvar_5 = texture2D (_MainTex, xlv_TEXCOORD0);
  mainTex_4 = tmpvar_5;
  lowp vec4 tmpvar_6;
  tmpvar_6 = texture2D (_MainTex2, xlv_TEXCOORD0);
  mainTex2_3 = tmpvar_6;
  mediump float x_7;
  x_7 = (mainTex_4.w - 0.5);
  if ((x_7 < 0.0)) {
    discard;
  };
  lowp float tmpvar_8;
  tmpvar_8 = mix (-1.0, 1.0, xlv_COLOR.y);
  mediump vec4 tmpvar_9;
  tmpvar_9 = mix (mainTex_4, mainTex2_3, vec4(tmpvar_8));
  highp vec3 ws_10;
  ws_10 = tmpvar_9.xyz;
  ws_10 = (ws_10 - vec3(0.03125, 0.001953125, 0.0625));
  highp vec3 uvw_11;
  uvw_11 = (floor((ws_10 * vec3(16.0, 256.0, 8.0))) / vec3(16.0, 256.0, 8.0));
  highp vec2 tmpvar_12;
  tmpvar_12.x = ((uvw_11.x / 8.0) + uvw_11.z);
  tmpvar_12.y = uvw_11.y;
  highp vec4 tmpvar_13;
  lowp vec4 tmpvar_14;
  tmpvar_14 = impl_low_texture2DLodEXT (_GradTex, tmpvar_12, 0.0);
  tmpvar_13 = tmpvar_14;
  highp vec3 uvw_15;
  uvw_15 = (floor((
    (ws_10 + vec3(0.0625, 0.0, 0.0))
   * vec3(16.0, 256.0, 8.0))) / vec3(16.0, 256.0, 8.0));
  highp vec2 tmpvar_16;
  tmpvar_16.x = ((uvw_15.x / 8.0) + uvw_15.z);
  tmpvar_16.y = uvw_15.y;
  highp vec4 tmpvar_17;
  lowp vec4 tmpvar_18;
  tmpvar_18 = impl_low_texture2DLodEXT (_GradTex, tmpvar_16, 0.0);
  tmpvar_17 = tmpvar_18;
  highp vec3 uvw_19;
  uvw_19 = (floor((
    (ws_10 + vec3(0.0, 0.00390625, 0.0))
   * vec3(16.0, 256.0, 8.0))) / vec3(16.0, 256.0, 8.0));
  highp vec2 tmpvar_20;
  tmpvar_20.x = ((uvw_19.x / 8.0) + uvw_19.z);
  tmpvar_20.y = uvw_19.y;
  highp vec4 tmpvar_21;
  lowp vec4 tmpvar_22;
  tmpvar_22 = impl_low_texture2DLodEXT (_GradTex, tmpvar_20, 0.0);
  tmpvar_21 = tmpvar_22;
  highp vec3 uvw_23;
  uvw_23 = (floor((
    (ws_10 + vec3(0.0625, 0.00390625, 0.0))
   * vec3(16.0, 256.0, 8.0))) / vec3(16.0, 256.0, 8.0));
  highp vec2 tmpvar_24;
  tmpvar_24.x = ((uvw_23.x / 8.0) + uvw_23.z);
  tmpvar_24.y = uvw_23.y;
  highp vec4 tmpvar_25;
  lowp vec4 tmpvar_26;
  tmpvar_26 = impl_low_texture2DLodEXT (_GradTex, tmpvar_24, 0.0);
  tmpvar_25 = tmpvar_26;
  highp vec3 uvw_27;
  uvw_27 = (floor((
    (ws_10 + vec3(0.0, 0.0, 0.125))
   * vec3(16.0, 256.0, 8.0))) / vec3(16.0, 256.0, 8.0));
  highp vec2 tmpvar_28;
  tmpvar_28.x = ((uvw_27.x / 8.0) + uvw_27.z);
  tmpvar_28.y = uvw_27.y;
  highp vec4 tmpvar_29;
  lowp vec4 tmpvar_30;
  tmpvar_30 = impl_low_texture2DLodEXT (_GradTex, tmpvar_28, 0.0);
  tmpvar_29 = tmpvar_30;
  highp vec3 uvw_31;
  uvw_31 = (floor((
    (ws_10 + vec3(0.0625, 0.0, 0.125))
   * vec3(16.0, 256.0, 8.0))) / vec3(16.0, 256.0, 8.0));
  highp vec2 tmpvar_32;
  tmpvar_32.x = ((uvw_31.x / 8.0) + uvw_31.z);
  tmpvar_32.y = uvw_31.y;
  highp vec4 tmpvar_33;
  lowp vec4 tmpvar_34;
  tmpvar_34 = impl_low_texture2DLodEXT (_GradTex, tmpvar_32, 0.0);
  tmpvar_33 = tmpvar_34;
  highp vec3 uvw_35;
  uvw_35 = (floor((
    (ws_10 + vec3(0.0, 0.00390625, 0.125))
   * vec3(16.0, 256.0, 8.0))) / vec3(16.0, 256.0, 8.0));
  highp vec2 tmpvar_36;
  tmpvar_36.x = ((uvw_35.x / 8.0) + uvw_35.z);
  tmpvar_36.y = uvw_35.y;
  highp vec4 tmpvar_37;
  lowp vec4 tmpvar_38;
  tmpvar_38 = impl_low_texture2DLodEXT (_GradTex, tmpvar_36, 0.0);
  tmpvar_37 = tmpvar_38;
  highp vec3 uvw_39;
  uvw_39 = (floor((
    (ws_10 + vec3(0.0625, 0.00390625, 0.125))
   * vec3(16.0, 256.0, 8.0))) / vec3(16.0, 256.0, 8.0));
  highp vec2 tmpvar_40;
  tmpvar_40.x = ((uvw_39.x / 8.0) + uvw_39.z);
  tmpvar_40.y = uvw_39.y;
  highp vec4 tmpvar_41;
  lowp vec4 tmpvar_42;
  tmpvar_42 = impl_low_texture2DLodEXT (_GradTex, tmpvar_40, 0.0);
  tmpvar_41 = tmpvar_42;
  highp vec3 tmpvar_43;
  tmpvar_43 = ((ws_10 * vec3(16.0, 256.0, 8.0)) + vec3(16.0, 256.0, 8.0));
  highp vec3 tmpvar_44;
  tmpvar_44 = fract(abs(tmpvar_43));
  highp float tmpvar_45;
  if ((tmpvar_43.x >= 0.0)) {
    tmpvar_45 = tmpvar_44.x;
  } else {
    tmpvar_45 = -(tmpvar_44.x);
  };
  highp float tmpvar_46;
  if ((tmpvar_43.y >= 0.0)) {
    tmpvar_46 = tmpvar_44.y;
  } else {
    tmpvar_46 = -(tmpvar_44.y);
  };
  highp float tmpvar_47;
  if ((tmpvar_43.z >= 0.0)) {
    tmpvar_47 = tmpvar_44.z;
  } else {
    tmpvar_47 = -(tmpvar_44.z);
  };
  highp vec3 tmpvar_48;
  tmpvar_48.x = tmpvar_45;
  tmpvar_48.y = tmpvar_46;
  tmpvar_48.z = tmpvar_47;
  highp vec3 tmpvar_49;
  tmpvar_49 = clamp (tmpvar_48, 0.0, 1.0);
  mediump float tmpvar_50;
  tmpvar_50 = clamp ((abs(
    (mainTex_4.y - 0.5)
  ) * 3.0), 0.0, 1.0);
  highp float x_51;
  x_51 = ((1.0 - tmpvar_50) - mix (-1.0, 1.0, abs(_Fade)));
  if ((x_51 < 0.0)) {
    discard;
  };
  col_2.w = tmpvar_9.w;
  lowp float tmpvar_52;
  tmpvar_52 = (1.8 * xlv_COLOR.x);
  ao_1 = tmpvar_52;
  lowp float tmpvar_53;
  tmpvar_53 = mix (-0.2, 1.0, xlv_COLOR.x);
  ao_1 = (clamp (ao_1, 0.0, 1.0) * tmpvar_53);
  highp float tmpvar_54;
  tmpvar_54 = mix (-0.4, 1.8, ao_1);
  ao_1 = tmpvar_54;
  highp vec3 tmpvar_55;
  tmpvar_55 = mix (mix (mix (
    mix (tmpvar_13, tmpvar_17, tmpvar_49.xxxx)
  , 
    mix (tmpvar_21, tmpvar_25, tmpvar_49.xxxx)
  , tmpvar_49.yyyy), mix (
    mix (tmpvar_29, tmpvar_33, tmpvar_49.xxxx)
  , 
    mix (tmpvar_37, tmpvar_41, tmpvar_49.xxxx)
  , tmpvar_49.yyyy), tmpvar_49.zzzz).xyz, tmpvar_9.xyz, vec3(tmpvar_54));
  col_2.xyz = tmpvar_55;
  lowp vec3 tmpvar_56;
  tmpvar_56 = vec3(((col_2.y / 2.0) + (xlv_COLOR.x / 2.0)));
  highp vec3 tmpvar_57;
  tmpvar_57 = mix (col_2.xyz, tmpvar_56, vec3(_AO));
  col_2.xyz = tmpvar_57;
  gl_FragData[0] = col_2;
}


#endif
"
}
}
Program "fp" {
SubProgram "gles " {
""
}
}
 }
}
}